<!DOCTYPE html>
<html lang="ch" xmlns:th="http://www.thymeleaf.org">

<head>
  <meta charset="utf-8">
  <title>具体Item信息</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" th:href="@{/lib/layui-v2.6.3/css/layui.css}" media="all">
  <link rel="stylesheet" th:href="@{/css/public.css}" media="all">
</head>

<body>
<div class="layuimini-container">
  <div class="layuimini-main">

    <fieldset class="table-search-fieldset">
      <legend>搜索具体Item信息</legend>
      <div style="margin: 10px 10px 10px 10px">
        <form class="layui-form layui-form-pane layuimini-form" th:action="@{'/categories/'+${categoryId}+'/products/'+${productId}+'/searchItem'}">
          <div class="layui-form-item">
            <div class="layui-inline">
              <label class="layui-form-label">具体ItemID</label>
              <div class="layui-input-inline">
                <input type="text" name="itemId" autocomplete="off" class="layui-input">
              </div>
            </div>


            <div class="layui-inline">
              <!--                            lay-submit lay-filter="data-search-btn"-->
              <input type="submit" class="layui-btn layui-btn-primary" value="搜 索"><i class="layui-icon" name="searchBtn"></i></input>
            </div>
          </div>
        </form>
      </div>
    </fieldset>

    <!--数据的表格-->
    <div class="layui-form layuimini-form layui-form-pane">
      <table class="layui-hide" id="TableId" lay-filter="currentTableFilter">
        <div class="layui-btn-container" style="margin: 10px 5px 5px 5px">
          <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="itemAdd"><a th:href="@{'/categories/'+${categoryId}+'/products/'+${productId}+'/addItem'}">添加</a></button>
        </div>
        <table class="layui-table">
          <tr>

            <th>具体ItemID</th>
            <th>具体Item售价</th>
            <th>具体Item进价</th>
            <th>具体Item可供应量</th>
            <th>具体Item属性</th>
            <th>具体Item状态</th>
            <th>操作</th>

          </tr>

          <tr th:if="${itemList.size()} eq 0">
            <td colspan="12">没有Item信息！！</td>
          </tr>
          <tr th:each="item : ${itemList}">
            <!--如何传值？-->
            <td th:text="${item.itemId}" />
            <td th:text="${item.listPrice}" />
            <td th:text="${item.unitCost}" />
            <td th:text="${item.supplierId}" />
            <td th:text="${item.attr1}" />
            <th th:switch="${item.status}">
              <div th:case="'T'">
                <button class="layui-btn layui-btn-normal layui-btn-xs " STYLE="background-color: #4b5461">
                  <a th:href="@{'/categories/'+${categoryId}+'/products/'+${productId}+'/updateState/'+${item.itemId}+'?itemState=P'}">
                  未上架
                  </a>
                </button>
              </div>
              <div th:case="'P'">
                <button class="layui-btn layui-btn-normal layui-btn-xs data-count-edit">
                  <a th:href="@{'/categories/'+${categoryId}+'/products/'+${productId}+'/updateState/'+${item.itemId}+'?itemState=T'}">
                    已上架
                  </a>
                </button>
              </div>
            </th>
            <td>
              <button class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" >
                         <a th:href="@{'items/'+${item.itemId}}">
                编辑
                         </a>
              </button>
              <button class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-submit lay-filter="deleteBtn" th:id="${item.itemId}">
                         <a th:href="@{'deleteItems/'+${item.itemId}}">
                删除
                         </a>
              </button>
            </td>

          </tr>
        </table>
      </table>
    </div>
    <a class="layui-btn layui-btn-warm" th:href="@{'/categories/'+${categoryId}+'/products'}">返回Products</a>

  </div>
</div>
<!--<script src="/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>-->
<!--<script src="/js/lay-config.js?v=1.0.4" charset="utf-8"></script>-->
<!--<script>-->
<!--    layui.use(['form','miniTab'], function () {-->
<!--        var form = layui.form,-->
<!--            layer = layui.layer,-->
<!--            miniTab = layui.miniTab;-->

<!--        //监听提交-->
<!--        form.on('submit(searchBtn)', function (data) {-->
<!--            var url = window.location.href+"/searchItem";-->
<!--            var xhr = new XMLHttpRequest();-->
<!--            var json = JSON.stringify(data.field)-->
<!--            var index = layer.alert(json, {-->
<!--                title: '最终的提交信息'-->
<!--            }, function () {-->
<!--                -->
<!--            });-->
<!--            return false;-->
<!--        });-->

<!--    });-->

<!--</script>-->
</body>

</html>